import Vue from 'vue'
import VueRouter from 'vue-router'     //引入
import Router from 'vue-router'
Vue.use(Router)
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [     //定义路由对象

  {
    path: '/',   ///首页
    name: 'Home',
    component: () => import('../views/Home.vue'),
    meta:{
      isShowTabbar:true
    }
  },
  {
    path: '/about',  //分类
    name: 'About',
    component: () => import('../views/About.vue'),
    meta:{
      isShowTabbar:true
    }
  },
  {
    path: '/cart',   //购物车
    name: 'cart',
    component: () => import('../views/cart.vue'),
    meta:{
      isShowTabbar:true
    }
  },
  {
    path: '/user',   //我的
    name: 'user',
    component: () => import('../views/user.vue'),
    meta:{
      isShowTabbar:true
    }
  },

  {
    path: '/userlogin',   //我的
    name: 'userlogin',
    component: () => import('../views/userlogin.vue')
  },
  {
    path: '/register',   //我的
    name: 'register',
    component: () => import('../views/register.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router
